﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入一个字符串");
            string str = Console.ReadLine();
            int letterCount = 0;
            int numCount = 0;
            int nextCount = 0;
            foreach (var c in str)
            {
                if (char.IsLetter(c))
                {
                    letterCount++;
                }
                else if (char.IsDigit(c))
                {
                    numCount++;
                }
                else if (char.IsWhiteSpace(c))
                {
                    nextCount++;
                }
             }
            Console.WriteLine("您输入的字符串中，字母有{0}个，数字有{1}个，空格有{2}个", letterCount, numCount, nextCount);
                
         }
    }
}
